import yaml


def get_dbconfig(yaml_file,Env):
    try:
        # 打开并加载YAML文件
        with open(yaml_file, 'r', encoding='gbk') as f:
            config = yaml.safe_load(f)

        # 提取testEnv字段的值（本身已是字典格式）
        test_env = config.get(Env, {})
        return test_env
    except Exception:
        return {}